


import java.io.*;
import java.lang.*;
import java.util.*;

/**
 *
 * @author Harshit
 */
public class peer_cfg {

    /**
     *
     * @author Harshit
     */
	static Vector<String> peerID=new Vector<String>();
 //read peerid from file
    static Vector<String> hostName = new Vector<String>();
  //hostname from file
    static Vector<Integer> portNo = new Vector<Integer>();
    //portno from file
    static Vector<Integer> isPresent = new Vector<Integer>();

    void peer_cfg()
    {
    	System.out.println("i am in peer cfg");  
    	LoadSettings();    	
    }
    public static void LoadSettings() {

        try {
        	System.out.println("i am in peer cfg");  
            BufferedReader inputReader = new BufferedReader(new FileReader("PeerInfo.cfg"));
            String line;
            int i = 1;
            int j=0;         
            
            while ((line = inputReader.readLine()) != null) {//read till end of file

                StringTokenizer token = new StringTokenizer(line);//token to break document

                while (token.hasMoreTokens()) {
                	int count=0;
                	String subToken = token.nextToken();
                    peerID.add(subToken);
                  //  peerID.addElement(sr);
                    String subToken1 = token.nextToken();
                    count=i+1;
                    hostName.add(subToken1);
                    //hostName.addElement(subToken1);
                    String subToken2 = token.nextToken();
                    portNo.add(Integer.parseInt(subToken2));
                   // portNo.addElement(Integer.parseInt(subToken2));
                    String subToken3 = token.nextToken();
                    isPresent.add(Integer.parseInt(subToken3));
                    //isPresent.addElement(Integer.parseInt(subToken3));
                    count++;
                    i++;
                    //if(count==i)
                    // System.out.println("broken token");
                }
            }
            inputReader.close();
        } catch (IOException e) {
        	System.out.println("Error:"+e);
        }
    }
}